#include "Render.h"
#include <GL/glew.h>
#include <iostream>
void GLClearError()
{
	while (glGetError() != GL_NO_ERROR);
}

bool GLLogCall(const char* function, const char* file, int line)
{
	while (GLenum error = glGetError()) {
		std::cout << "[OepnGL Error] (" << error << ")" << function << " " << file << " " << line << std::endl;
		return false;
	}
	return true;
}

void Render::Clear()
{
	glClear(GL_COLOR_BUFFER_BIT);
}

void Render::Draw(VertexArray& vao, IndexBuffer& ibo, Shader& shader)
{
	vao.Bind();
	ibo.Bind();
	GLCall(glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr));
}
